#include "Channels.h"
#include "ChannelManager.h"
#include "Resource.h"
#include "String.h"
#include "SharedPtr.h"
#include "ResourceManager.h"
#include "Database/DatabaseEnv.h"
#include "StringConverter.h"
#include "NGLog.h"
#include "Character.h"
#include "CharManager.h"
#include "Items.h"
#include "ItemManager.h"
#include "WorldPacket.h"
#include "Opcodes.h"
#include "RegionManager.h"
#include "Towns.h"
#include "TownManager.h"
#include "Users.h"
#include "UserManager.h"
#include "Mails.h"
#include "MailManager.h"
#include "WSSocket.h"
#include "WSSocketManager.h"
#include "Message.h"
#include "MD5.h"
#include "Titles.h"
#include "TitleManager.h"
#include "Missions.h"
#include "MissionModels.h"
#include "MissionModelManager.h"
#include <curl/curl.h>
#include "XMLData.h"
#include "GameDataEnum.h"
#include "ProtocolDealEnums.h"
#include "ResourceEventEnum.h"
#include "GameThreadLogic.h"
#include "CenterBankManager.h"
#include "GameDefine.h"
#include "MJGameLogic.h"
#include "GameStruct.h"
#include <fstream>
#include "String.h"
#include "TWMJGameLogic.h"
#include "TWMJEnum.h"

typedef Json::Value JsonValue;
using namespace AIScript;
//构造函数
TWMJGameLogic::TWMJGameLogic()
{
	
}
//创建实例
TWMJGameLogic *TWMJGameLogic::Create(const uint32 &ai, std::map<uint8, AddTaiType> &AddTaiTypeGroup, const bool &bLg)
{
	TWMJGameLogic *temp = new TWMJGameLogic;
	if (temp)
	{
		temp->init(ai);
		temp->GetTaiType(AddTaiTypeGroup);
		temp->FuncInit(bLg);
		return temp;
	}
	return NULL;
}
//通过Json获取配置信息
bool TWMJGameLogic::GetTaiType(std::map<uint8, AddTaiType> &AddTaiTypeGroup)
{
	//std::map<uint8, AddTaiType> AddTaiTypeGroup;

	if (M_jGameRule.isMember("TaiType"))
	{
		JsonValue value  = M_jGameRule["TaiType"];
		JsonValue::Members member = value.getMemberNames();//获取所有的
		JsonValue::Members::iterator iter = member.begin();
		for (iter; iter != member.end(); iter++)
		{
			std::string readstr = *iter;
			if (value[readstr].isUInt())
			{
				AddTaiType bPR;
				//获取牌型相应配置信息
				bPR.Type = uint8((atoi(readstr.c_str())));
				bPR.Num = 0;
				bPR.Mult = uint8((value[readstr].asUInt()));
				Log.Debug("TWMJGameLogic::GetTaiType", "Type[%u]  Mult[%u]", bPR.Type, bPR.Mult);
				std::map<uint8, AddTaiType>::iterator fit = AddTaiTypeGroup.find(bPR.Type);
				if (fit == AddTaiTypeGroup.end())
				{
					AddTaiTypeGroup.insert(std::make_pair(bPR.Type, bPR));
				}
				else
				{
					fit->second = bPR;
				}
            }
			else if (value[readstr].isString())
			{
				//值为字符串
			}
			else if(value[readstr].isDouble())
			{
				//值为双精度浮点
			}
			else
			{
				//其他类型数据
			}
		}

		Log.Debug("TWMJGameLogic::GetTaiType", "read success !");
		return true;
	}
	else
	{
		Log.Debug("TWMJGameLogic::GetTaiType", "read failed !");
		return false;
	}

}
//注册初始化
void TWMJGameLogic::FuncInit(const bool &bLg)
{
	//清一色
	register_HuPaiTypeCheck_Before(en_HuPaiTaiType_QingYiSe, (BeforeAnalyse)&MJGameLogic::IsQinYiSeHaveNotJianPai);
	LogDeBug("TWMJGameLogic::TWMJGameLogic", "register_HuPaiTypeCheck_Before:%x %s", en_HuPaiTaiType_QingYiSe, "MJGameLogic::IsQingYiSe");
	//三暗刻
	register_HuPaiTypeCheck_After(en_HuPaiTaiType_SanAnKe, (AfterAnalyse)&TWMJGameLogic::IsSanAnKe);
	LogDeBug("TWMJGameLogic::TWMJGameLogic", "register_HuPaiTypeCheck_After:%x %s", en_HuPaiTaiType_SanAnKe, "TWMJGameLogic::IsSanAnKe");
	//碰碰胡
	register_HuPaiTypeCheck_After(en_HuPaiTaiType_PengPengHu, (AfterAnalyse)&TWMJGameLogic::IsPengPengHu);
	LogDeBug("TWMJGameLogic::TWMJGameLogic", "register_HuPaiTypeCheck_After:%x %s", en_HuPaiTaiType_PengPengHu, "TWMJGameLogic::IsPengPengHu");
	//小三元
	register_HuPaiTypeCheck_After(en_HuPaiTaiType_XiaoSanYuan, (AfterAnalyse)&TWMJGameLogic::IsXiaoSanYuan);
	LogDeBug("TWMJGameLogic::TWMJGameLogic", "register_HuPaiTypeCheck_After:%x %s", en_HuPaiTaiType_XiaoSanYuan, "MJGameLogic::IsXiaoSanYuan");
	//混一色
	register_HuPaiTypeCheck_Before(en_HuPaiTaiType_CouYiSe, (BeforeAnalyse)&TWMJGameLogic::IsCouYiSe);
	LogDeBug("TWMJGameLogic::TWMJGameLogic", "register_HuPaiTypeCheck_Before:%x %s", en_HuPaiTaiType_CouYiSe, "TWMJGameLogic::IsHunYiSe");
	//四暗刻
	register_HuPaiTypeCheck_After(en_HuPaiTaiType_SiAnKe, (AfterAnalyse)&TWMJGameLogic::IsSiAnKe);
	LogDeBug("TWMJGameLogic::TWMJGameLogic", "register_HuPaiTypeCheck_After:%x %s", en_HuPaiTaiType_SiAnKe, "TWMJGameLogic::IsSiAnKe");
	//大三元
	register_HuPaiTypeCheck_After(en_HuPaiTaiType_DaSanYuan, (AfterAnalyse)&TWMJGameLogic::IsDaSanYuan);
	LogDeBug("TWMJGameLogic::TWMJGameLogic", "register_HuPaiTypeCheck_Before:%x %s", en_HuPaiTaiType_DaSanYuan, "TWMJGameLogic::IsDaSanYuan");
	//字一色
	register_HuPaiTypeCheck_After(en_HuPaiTaiType_ZiYiSe, (AfterAnalyse)&TWMJGameLogic::IsZiYiSe);
	LogDeBug("TWMJGameLogic::TWMJGameLogic", "register_HuPaiTypeCheck_After:%x %s", en_HuPaiTaiType_ZiYiSe, "TWMJGameLogic::IsZiYiSe");
	//五暗刻
	register_HuPaiTypeCheck_After(en_HuPaiTaiType_WuAnKe, (AfterAnalyse)&TWMJGameLogic::IsWuAnKe);
	LogDeBug("TWMJGameLogic::TWMJGameLogic", "register_HuPaiTypeCheck_After:%x %s", en_HuPaiTaiType_WuAnKe, "TWMJGameLogic::IsWuAnKe");
	//小四喜
	register_HuPaiTypeCheck_After(en_HuPaiTaiType_XiaoSiXi, (AfterAnalyse)&TWMJGameLogic::IsXiaoSiXi);
	LogDeBug("TWMJGameLogic::TWMJGameLogic", "register_HuPaiTypeCheck_After:%x %s", en_HuPaiTaiType_XiaoSiXi, "TWMJGameLogic::IsXiaoSiXi");
	//大四喜
	register_HuPaiTypeCheck_After(en_HuPaiTaiType_DaSiXi, (AfterAnalyse)&TWMJGameLogic::IsDaSiXi);
	LogDeBug("TWMJGameLogic::TWMJGameLogic", "register_HuPaiTypeCheck_After:%x %s", en_HuPaiTaiType_DaSiXi, "TWMJGameLogic::IsDaSiXi");
	//门清
	register_HuPaiTypeCheck_Before(en_HuPaiTaiType_MenQing, (BeforeAnalyse)&MJGameLogic::IsMenQing);
	LogDeBug("TWMJGameLogic::TWMJGameLogic", "register_HuPaiTypeCheck_After:%x %s", en_HuPaiTaiType_MenQing, "MJGameLogic::IsMenQing");
	//独听
	register_HuPaiTypeCheck_After(en_HuPaiTaiType_DuTin, (AfterAnalyse)&TWMJGameLogic::IsDuting);
	LogDeBug("TWMJGameLogic::TWMJGameLogic", "register_HuPaiTypeCheck_After:%x %s", en_HuPaiTaiType_DuTin, "TWMJGameLogic::IsDuting");

	if (bLg)
	{
		//呖咕呖咕
		register_HuPaiTypeCheck_Before(en_HuPaiTaiType_LiGuLiGu, (BeforeAnalyse)&TWMJGameLogic::IsLiGuLiGu);
		LogDeBug("TWMJGameLogic::TWMJGameLogic", "register_HuPaiTypeCheck_Before:%x %s", en_HuPaiTaiType_LiGuLiGu, "MJGameLogic::IsLiGuLiGu");
	}

}

/***********************************************番型及牌型检测********************************************************/

//三暗刻
bool TWMJGameLogic::IsSanAnKe(tagAnalyseItem *AnalyseItem, std::vector<tagWeaveItem> &WeaveArry, uint8 ui8CurrentCard)
{
	uint8 count1 = 0;
	uint8 count2 = 0;
	uint8 carddata = 0;
	uint8 cardsum = 0;

	for (uint8 i = 0; i < 5; ++i)
	{
		if (AnalyseItem->ui8WeaveKind[i] != WIK_RIGHT && AnalyseItem->ui8WeaveKind[i] != WIK_CENTER && AnalyseItem->ui8WeaveKind[i] != WIK_LEFT)
		{
			if ((AnalyseItem->ui8CardData[i][0] >= 51 && AnalyseItem->ui8CardData[i][0] <= 53))
			{
				carddata = AnalyseItem->ui8CardData[i][0];
				cardsum += carddata;
				++count1;
			}
			++count2;
		}
	}
	Log.Debug(" TWMJGameLogic::IsSanAnKe", "count2[%d]", count2);
	for (uint8 i = 0; i < WeaveArry.size(); ++i)
	{
		if(WeaveArry[i].ui8WeaveKind == WIK_PENG)
			--count2;
	}

	//小三元或者大三元
	if (count1 == 3 || (count1 == 2 && AnalyseItem->ui8CardEye == (156 - cardsum)))
		return false;

		if (count2 != 3)
			return false;

		Log.Debug(" TWMJGameLogic::IsSanAnKe", "count2[%d]", count2);
		return true;
}

//四暗刻
bool TWMJGameLogic::IsSiAnKe(tagAnalyseItem *AnalyseItem, std::vector<tagWeaveItem> &WeaveArry, uint8 ui8CurrentCard)
{
	uint8 count1 = 0;
	uint8 count2 = 0;
	uint8 carddata = 0;
	uint8 cardsum = 0;

	for (uint8 i = 0; i < 5; ++i)
	{
		if (AnalyseItem->ui8WeaveKind[i] != WIK_RIGHT && AnalyseItem->ui8WeaveKind[i] != WIK_CENTER && AnalyseItem->ui8WeaveKind[i] != WIK_LEFT)
		{
			if ((AnalyseItem->ui8CardData[i][0] >= 51 && AnalyseItem->ui8CardData[i][0] <= 53))
			{
				carddata = AnalyseItem->ui8CardData[i][0];
				cardsum += carddata;
				++count1;
			}
			++count2;
		}
	}
	for (uint8 i = 0; i < WeaveArry.size(); ++i)
	{
		if (WeaveArry[i].ui8WeaveKind == WIK_PENG)
			--count2;
	}
      
        //小三元或者大三元
	if (count1 == 3 || (count1 == 2 && AnalyseItem->ui8CardEye == (156 - cardsum)))
		return false;

	if (count2 != 4)
		return false;

  Log.Debug(" TWMJGameLogic::IsSiAnKe", "count2[%d]", count2);
	return true;
}
//五暗刻
bool TWMJGameLogic::IsWuAnKe(tagAnalyseItem *AnalyseItem, std::vector<tagWeaveItem> &WeaveArry, uint8 ui8CurrentCard)
{
	uint8 count1 = 0;
	uint8 count2 = 0;
	uint8 carddata = 0;
	uint8 cardsum = 0;

	for (uint8 i = 0; i < 5; ++i)
	{
		if (AnalyseItem->ui8WeaveKind[i] != WIK_RIGHT && AnalyseItem->ui8WeaveKind[i] != WIK_CENTER && AnalyseItem->ui8WeaveKind[i] != WIK_LEFT)
		{
			if ((AnalyseItem->ui8CardData[i][0] >= 51 && AnalyseItem->ui8CardData[i][0] <= 53))
			{
				carddata = AnalyseItem->ui8CardData[i][0];
				cardsum += carddata;
				++count1;
			}
			++count2;
		}
	}
	for (uint8 i = 0; i < WeaveArry.size(); ++i)
	{
		if (WeaveArry[i].ui8WeaveKind == WIK_PENG)
			--count2;
	}


	//小三元或者大三元
	if (count1 == 3 || (count1 == 2 && AnalyseItem->ui8CardEye == (156 - cardsum)))
		return false;

	if (count2 != 5)
		return false;

	Log.Debug(" TWMJGameLogic::IsWuAnKe", "count2[%d]", count2);
	return true;
}
//小三元
bool TWMJGameLogic::IsXiaoSanYuan(tagAnalyseItem *AnalyseItem, std::vector<tagWeaveItem> &WeaveArry, uint8 ui8CurrentCard)
{

	uint8 count = 0;
	uint8 carddata = 0;
	uint8 cardsum = 0;
	for (uint8 i = 0; i < 5; ++i)
	{
		if (AnalyseItem->ui8WeaveKind[i] != WIK_RIGHT && AnalyseItem->ui8WeaveKind[i] != WIK_CENTER && AnalyseItem->ui8WeaveKind[i] != WIK_LEFT)
		{
			if ((AnalyseItem->ui8CardData[i][0] >= 51 && AnalyseItem->ui8CardData[i][0] <= 53) && AnalyseItem->ui8CardData[i][0] != carddata)
			{
				carddata = AnalyseItem->ui8CardData[i][0];
				cardsum += carddata;
				++count;
			}
		}
	}

	if (count != 2)
		return false;
	else
	{
		if (AnalyseItem->ui8CardEye != (156 - cardsum))
			return false;

		Log.Debug("TWMJGameLogic::IsXiaoSanYuan", "count[%d] cardsum[%d] ui8CardEye[%d]", count, cardsum, AnalyseItem->ui8CardEye);
		return true;
	}
}
//大三元
bool TWMJGameLogic::IsDaSanYuan(tagAnalyseItem *AnalyseItem, std::vector<tagWeaveItem> &WeaveArry, uint8 ui8CurrentCard)
{

	uint8 count = 0;
	uint8 carddata = 0;

	for (uint8 i = 0; i < 5; ++i)
	{
		if (AnalyseItem->ui8WeaveKind[i] != WIK_RIGHT && AnalyseItem->ui8WeaveKind[i] != WIK_CENTER && AnalyseItem->ui8WeaveKind[i] != WIK_LEFT)
		{
			if ((AnalyseItem->ui8CardData[i][0] >= 51 && AnalyseItem->ui8CardData[i][0] <= 53) && AnalyseItem->ui8CardData[i][0] != carddata)
			{
				carddata = AnalyseItem->ui8CardData[i][0];
				++count;
			}
		}
	}

	if (count != 3)
		return false;

	Log.Debug("TWMJGameLogic::IsDaSanYuan", "count[%d]", count);
	return true;
}
//字一色
bool TWMJGameLogic::IsZiYiSe(tagAnalyseItem *AnalyseItem, std::vector<tagWeaveItem> &WeaveArry, uint8 ui8CurrentCard)
{
	uint8 count = 0;
	uint8 carddata = 0;
	uint8 cardsum = 0;
	for (uint8 i = 0; i < 5; ++i)
	{
		if (AnalyseItem->ui8CardData[i][0] / 10 != 4 || AnalyseItem->ui8CardData[i][0] / 10 != 5)
			return false;
		if ((AnalyseItem->ui8CardData[i][0] >= 41 && AnalyseItem->ui8CardData[i][0] <= 44) && AnalyseItem->ui8CardData[i][0] != carddata)
		{
			if (AnalyseItem->ui8WeaveKind[i] != WIK_RIGHT && AnalyseItem->ui8WeaveKind[i] != WIK_CENTER && AnalyseItem->ui8WeaveKind[i] != WIK_LEFT)
			{
				carddata = AnalyseItem->ui8CardData[i][0];
				cardsum += carddata;
				++count;
			}

		}
	}

	if(AnalyseItem->ui8CardEye > 39)
		return false;

	//排除大、小四喜
	if ((count == 3 && (AnalyseItem->ui8CardEye == (170 - cardsum))) || count == 4)
		return false;

	Log.Debug("TWMJGameLogic::IsZiYiSe", "count[%d]", count);
	return true;
}
//凑一色
bool TWMJGameLogic::IsCouYiSe(tagAnalyseItem *AnalyseItem, std::vector<tagWeaveItem> &WeaveArry, uint8 ui8CurrentCard)
{

	uint8 count1 = 0;
	uint8 count2 = 0;
	uint8 carddata = 0;
	uint8 cardsum = 0;
	uint8 cardcolor = 0;
	bool isZp = true;
	std::vector<uint8> onlyZiPai;
	VecInit<uint8>(onlyZiPai, 5, 0);
	for (uint8 i = 0; i < 5; ++i)
	{
		if (AnalyseItem->ui8CardData[i][0] / 10 == 6)
			return false;
		if ((AnalyseItem->ui8CardData[i][0] >= 11 && AnalyseItem->ui8CardData[i][0] <= 53) && AnalyseItem->ui8CardData[i][0] != carddata)
		{
			if (AnalyseItem->ui8CardData[i][0] >= 11 && AnalyseItem->ui8CardData[i][0] <= 39)
			{
				onlyZiPai.push_back(AnalyseItem->ui8CardData[i][0] / 10);
			}
			if (AnalyseItem->ui8CardData[i][0] >= 41 && AnalyseItem->ui8CardData[i][0] <= 44)
			{
				if (AnalyseItem->ui8WeaveKind[i] != WIK_RIGHT && AnalyseItem->ui8WeaveKind[i] != WIK_CENTER && AnalyseItem->ui8WeaveKind[i] != WIK_LEFT)
				{
					carddata = AnalyseItem->ui8CardData[i][0];
					cardsum += carddata;
					++count2;
				}
			}
		}
	}
	//判断是单一或全数牌
	cardcolor = onlyZiPai[0];
	for(uint8 i = 0; i < 5; ++i)
	{
		if(onlyZiPai[i] == cardcolor && !onlyZiPai[i])
		{
			cardcolor = onlyZiPai[i];
			++count1;
		}
		else
			isZp = false;
	}
	if(!isZp)
		return false;
	if(count1 == 6)
		return false;

	//将牌
	if ((AnalyseItem->ui8CardEye / 10 == 6) || AnalyseItem->ui8CardEye != onlyZiPai[0])
		return false;

	//排除大、小四喜
	if ((count2 == 3 && (AnalyseItem->ui8CardEye == (170 - cardsum))) || count2 == 4)
		return false;

	Log.Debug("TWMJGameLogic::IsCouYiSe", "字牌数目[%d]", count1);
	return true;
}
//小四喜
bool TWMJGameLogic::IsXiaoSiXi(tagAnalyseItem *AnalyseItem, std::vector<tagWeaveItem> &WeaveArry, uint8 ui8CurrentCard)
{

	uint8 count = 0;
	uint8 carddata = 0;
	uint8 cardsum = 0;
	for (uint8 i = 0; i < 5; ++i)
	{
		if (AnalyseItem->ui8WeaveKind[i] != WIK_RIGHT && AnalyseItem->ui8WeaveKind[i] != WIK_CENTER && AnalyseItem->ui8WeaveKind[i] != WIK_LEFT)
		{
			if ((AnalyseItem->ui8CardData[i][0] >= 41 && AnalyseItem->ui8CardData[i][0] <= 44) && AnalyseItem->ui8CardData[i][0] != carddata)
			{
				carddata = AnalyseItem->ui8CardData[i][0];
				cardsum += carddata;
				++count;
			}
		}
	}
	if (count != 3)
		return false;

	else
	{
		if (AnalyseItem->ui8CardEye != (170 - cardsum))
			return false;

		Log.Debug("TWMJGameLogic::IsXiaoSiXi", "count[%d]", count);
		return true;
	}
}
//大四喜
bool TWMJGameLogic::IsDaSiXi(tagAnalyseItem *AnalyseItem, std::vector<tagWeaveItem> &WeaveArry, uint8 ui8CurrentCard)
{

	uint8 count = 0;
	uint8 carddata = 0;

	for (uint8 i = 0; i < 5; ++i)
	{
		if (AnalyseItem->ui8WeaveKind[i] != WIK_RIGHT && AnalyseItem->ui8WeaveKind[i] != WIK_CENTER && AnalyseItem->ui8WeaveKind[i] != WIK_LEFT)
		{
			if ((AnalyseItem->ui8CardData[i][0] >= 41 && AnalyseItem->ui8CardData[i][0] <= 44) && AnalyseItem->ui8CardData[i][0] != carddata)
			{
				carddata = AnalyseItem->ui8CardData[i][0];
				++count;
			}
		}
	}
	if (count != 4)
		return false;

        Log.Debug("TWMJGameLogic::IsDaSiXi", "count[%d]", count);
        return true;
}
//独听
bool TWMJGameLogic::IsDuting(tagAnalyseItem *AnalyseItem, std::vector<tagWeaveItem> &WeaveArry, uint8 ui8CurrentCard)
{

	if (IsBianZhang(AnalyseItem, WeaveArry, ui8CurrentCard) || IsDanDiao(AnalyseItem, WeaveArry, ui8CurrentCard)
	 || IsKaZhang(AnalyseItem, WeaveArry, ui8CurrentCard))
		return true;
}
//对对胡
bool TWMJGameLogic::IsPengPengHu(tagAnalyseItem *AnalyseItem, std::vector<tagWeaveItem> &WeaveArry, uint8 ui8CurrentCard)
{
	// Log.Error("MJGameLogic::IsPengPengHu::ChannelBattleCalcUpdate","%d",__LINE__);
	for (uint8 i = 0; i < 5; ++i)
	{
		if (AnalyseItem->ui8WeaveKind[i] == WIK_RIGHT || AnalyseItem->ui8WeaveKind[i] == WIK_CENTER || AnalyseItem->ui8WeaveKind[i] == WIK_LEFT)
		{
			// Log.Error("MJGameLogic::IsPengPengHu::ChannelBattleCalcUpdate","%d", __LINE__);
			return false;
		}
	}

	Log.Debug("TWMJGameLogic::IsPengPengHu", "yes");
	return true;
}
//呖咕呖咕
bool TWMJGameLogic::IsLiGuLiGu(std::vector<uint8>& ui8CardIndex, std::vector<tagWeaveItem>& WeaveArry, uint8 ui8CurrentCard)
{

	uint8 count1 = 0;
	uint8 count2 = 0;
	std::vector<uint8> ui8CardTemp = ui8CardIndex;
	
	for (uint32 i = 0; i < MAX_INDEX; i++)
	{
		if (ui8CardTemp[i] == 0)
			continue;

		//刻子
		if (ui8CardTemp[i] == 3)
			++count1;
		
		//对子
		if (ui8CardTemp[i] == 2 && ui8CardTemp[i] % 10 == 0)
			count2 += ui8CardTemp[i] / 2;
	}

	//是否满足7对 1刻
	if (count1 != 1 && count2 != 7)
		return false;

	//Log.Debug("TWMJGameLogic::IsLiGuLiGu", "count1[%d] count2[%d]", count1, count2);
	return true;
}
//卡张
bool TWMJGameLogic::IsKaZhang(tagAnalyseItem *AnalyseItem, std::vector<tagWeaveItem> &WeaveArry, uint8 ui8CurrentCard)
{
	for (uint8 i = 0; i < 5; ++i)
	{
		if (AnalyseItem->ui8WeaveKind[i] == WIK_RIGHT || AnalyseItem->ui8WeaveKind[i] == WIK_CENTER || AnalyseItem->ui8WeaveKind[i] == WIK_LEFT)
		{

			if (AnalyseItem->ui8CardData[i][1] == ui8CurrentCard)
				return true;
		}
	}

	return false;
}
//边张
bool TWMJGameLogic::IsBianZhang(tagAnalyseItem *AnalyseItem, std::vector<tagWeaveItem> &WeaveArry, uint8 ui8CurrentCard)
{

	for (uint8 i = 0; i < 5; ++i)
	{
		if (AnalyseItem->ui8WeaveKind[i] == WIK_RIGHT || AnalyseItem->ui8WeaveKind[i] == WIK_CENTER || AnalyseItem->ui8WeaveKind[i] == WIK_LEFT)
		{
			if (AnalyseItem->ui8CardData[i][2] == ui8CurrentCard && GetCardValue(ui8CurrentCard) == 3)
				return true;
			if (AnalyseItem->ui8CardData[i][0] == ui8CurrentCard && GetCardValue(ui8CurrentCard) == 7)
				return true;
		}
	}

	return false;
}
//单调
bool TWMJGameLogic::IsDanDiao(tagAnalyseItem *AnalyseItem, std::vector<tagWeaveItem> &WeaveArry, uint8 ui8CurrentCard)
{
	// Log.Error("MJGameLogic::IsDanDiao::ChannelBattleCalcUpdate","%d", __LINE__);

	if (AnalyseItem->ui8CardEyeData[0] != ui8CurrentCard)
	{
		// Log.Error("MJGameLogic::IsDanDiao::ChannelBattleCalcUpdate","%d", __LINE__);
		return false;
	}
	// if (IsZhenPengPengHu(AnalyseItem, WeaveArry, ui8CurrentCard))
	// 	return true;

	return true;
}
